package com.example.automanagement.mapper;

import com.example.automanagement.entity.AutoDepartmentApproval;
import com.example.automanagement.entity.AutoGeneralApproval;
import com.example.automanagement.views.AutoArchiveStatus;
import com.example.automanagement.views.DriverArchiveStatus;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@Mapper
public interface AutoApprovalMapper {

    @Insert("insert into auto_department_approval(order_id,order_approver,approval_result,approval_describe,user_id,submit_time) " +
            "values (#{orderId},#{orderApprover},#{approvalResult},#{approvalDescribe},#{userId},#{submitTime})")
    void addAutoDepartmentApproval(AutoDepartmentApproval approval);


    void addAutoGeneralApproval(AutoGeneralApproval approval);
    @Select("select * from auto_archive_status where auto_status = '空闲' and auto_type = #{autoType}")
    List<AutoArchiveStatus> getFreePlateNum(String autoType);

    @Select("select * from driver_archive_status where driver_status = '空闲'")
    List<DriverArchiveStatus> getFreeDrivers();


    AutoGeneralApproval getAutoGeneralApproval(@Param("orderId") String orderId);

    AutoDepartmentApproval getAutoDepartmentApproval(@Param("orderId") String orderId);
}
